﻿@*
@using CleanArchitecture.Core.Helper
@using CleanArchitecture.Infrastructure.Entities
@using CleanArchitecture.Infrastructure.Models.Business.LostFound
@model LostReciveItemModel
@{
    Layout = "_BackendLayout";
    ViewData["Title"] = ViewBag.PageTitle as string;
    int currentSystemModuleId = ViewBag.CurrentSystemModuleId;
    LostReciveItemSearchModel searchModel = Model.CustomProperties["LostReciveItemSearchModel"] as LostReciveItemSearchModel ?? null;
}
@section cssstyles {
    <style type="text/css">
        body {
            display: flex;
            flex: auto;
            flex-direction: column;
            min-height: 0;
            background: #f0f2f5;
        }

        .backendlostrecivemanage {
            width: 100% !important;
            height: 100%;
            background-color: #fff;
            margin: 0 !important;
            padding: 10px 2px;
            position: absolute;
        }

        .layui-nav-tree .layui-this,
        .layui-nav-tree .layui-nav-item a:hover {
            background-color: #e6f7ff !important;
            color: #1890ff !important;
            font-weight: bold;
        }

        .layui-nav-tree .layui-this > a {
            background-color: inherit;
        }

        .layui-nav-tree .currentnav:after {
            transform: scaleY(1);
            opacity: 1;
            transition: transform .15s cubic-bezier(.645,.045,.355,1),opacity .15s cubic-bezier(.645,.045,.355,1);
            position: absolute;
            top: 0;
            left: auto;
            right: 0;
            bottom: 0;
            border-right: 3px solid #1890ff;
            height: 45px;
            content: "";
        }

        .layui-nav .layui-nav-item a {
            color: #393d49;
        }

        .layui-nav-tree .layui-nav-bar {
            background-color: #1890ff;
        }
        /*失物招领 - 物品领取*/
        .backendlostrecivemanage {
            width: 100% !important;
            min-height: 800px;
            background-color: #fff;
            margin: 0 !important;
            padding: 10px 0;
        }

        .backendlostrecivemanage .layui-nav-side {
            width: 100%;
            position: relative !important;
            color: #393D49 !important;
            background-color: #fff;
        }

        .backendlostrecivemanage .layui-form-switch {
            margin-top: 6px;
            height: 25px;
        }
    </style>
}
<div class="backendlostrecivemanage layui-main">
    <div class="layui-col-220" style="padding: 0;">
        <div class="layui-nav-custom-title">
            @ViewBag.PageTitle
        </div>
        <div class="layui-row layui-nav-custom-content">
            <ul class="layui-nav layui-nav-tree layui-nav-side" lay-filter="leftnav">
                <li class="layui-nav-item layui-this">
                    <a href="javascript:;" data-tab="unrecive" data-status="@((int)EntityEnumConfig.LostFoundStatus.PublishedandUnRecived)">未领取</a>
                </li>
                <li class="layui-nav-item">
                    <a href="javascript:;" data-tab="recived" data-status="@((int)EntityEnumConfig.LostFoundStatus.Recived)">已领取</a>
                </li>
            </ul>
        </div>
    </div>
    <div id="rightpanel" class="right-col-body">
        <fieldset class="layui-elem-field" style="margin: 5px 10px;">
            <div class="layui-field-box">
                <div class="layui-form-item">
                    <div class="layui-inline pagebuttongroup">
                        <div class="sidebar-collaps toolgroup" data-tips="收起侧边栏" data-type="collaps" data-side-fold="1" data-widthelement="layui-col-220" data-leftelement="right-col-body">
                            <i class="fa fa-outdent"></i>
                        </div>
                        <a class="layui-btn form-search-expand expand" data-formclassname="search-from" data-type="expand">
                            展开搜索 <i class="layui-icon layui-icon-down"></i>
                        </a>
                        @await Component.InvokeAsync("PageButton")
                    </div>
                </div>
            </div>
            <form class="layui-form search-from">
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">物品名称:</label>
                        <div class="layui-input-inline">
                            <input name="@searchModel.nameof(s => s.TitleKeyWords)" class="layui-input" autocomplete="off" placeholder="请输入搜索关键字" />
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">拾取站点：</label>
                        <div class="layui-input-inline">
                            <select name="@searchModel.nameof(s => s.FoundAtAddr)" lay-filter="foundataddrselect" lay-search></select>
                        </div>
                    </div>
                    <div class="layui-inline" id="dateRange">
                        <label class="layui-form-label">拾取时间:</label>
                        <div class="layui-input-inline">
                            <input name="dateRangeSelect" id="dateRangeSelect" class="layui-input" />
                        </div>
                    </div>
                    <div class="layui-inline">
                        <button class="layui-btn icon-btn" lay-filter="tbAdvSearch" lay-submit="">
                            <i class="layui-icon"></i>搜索
                        </button>
                    </div>
                </div>
            </form>
        </fieldset>
        <div class="layui-fluid" style="padding-left: 10px;" v-if="CurrentPanelTab === 'unrecive'">
            <table id="unrecivelisttable" lay-filter="lostlisttable"></table>
        </div>
        <div class="layui-fluid" style="padding-left: 10px;" v-else-if="CurrentPanelTab === 'recived'">
            <table id="recivedlisttable" lay-filter="lostlisttable"></table>
        </div>
    </div>
</div>
<input type="text" class="layui-hide" id="currentSystemModuleId" value="@currentSystemModuleId" />
@await Component.InvokeAsync("RecordButton")
<!-- 数据记录状态 -->
<script type="text/html" id="statusTemplate">
    {{#  if(d.Status == 10){ }}
    <span class="layui-badge">新录入-待审核</span>
    {{#  } else if(d.Status == 11){ }}
    <span class="layui-badge layui-bg-orange">区长已审核</span>
    {{#  } else if(d.Status == 12){ }}
    <span class="layui-badge layui-bg-green">中心已审核</span>
    {{#  } else if(d.Status == 20){ }}
    <span class="layui-badge layui-bg-blue">已发布-未领取</span>
    {{#  } else { }}
    <span class="layui-badge layui-bg-black">已发布-已领取</span>
    {{#  } }}
</script>
@section scripts{
    <script type="text/javascript">
        var lostrecivelisttableconfig = null;
        layui.use(['util'], function () {
            var util = layui.util;
            lostrecivelisttableconfig = {
                elem: null,
                id: "",
                url: '/api/backend/business/lostfound/getlostreciveditems',
                request: {
                    pageName: '@searchModel.nameof(p => p.Page)', //页码的参数名称，默认：page
                    limitName: '@searchModel.nameof(p => p.PageSize)' //每页数据量的参数名，默认：limit
                },
                method: 'post',
                contentType: 'application/json;charset=UTF-8',
                where: {
                    '@searchModel.nameof(s => s.FoundAtAddr)': "",
                    '@searchModel.nameof(s => s.FoundAtStart)': null,
                    '@searchModel.nameof(s => s.FoundAtEnd)': null,
                    '@searchModel.nameof(s => s.LostFoundStart)': null,
                    '@searchModel.nameof(s => s.LostFoundEnd)': null,
                    '@searchModel.nameof(s => s.TitleKeyWords)': "",
                    '@searchModel.nameof(s => s.Status)': 0
                },
                limits: [@searchModel.AvailablePageSizes],
                limit:  @searchModel.PageSize,
                cols: [[
                    { type: "checkbox", width: 50, fixed: "left" },
                    { field: 'Id', hide: true, title: 'ID' },
                    { field: '@Model.nameof(p => p.LostFoundCode)', title: '@(ReflectionExtensions.GetPropertyDisplayName<LostReciveItemModel>(m => m.LostFoundCode))', width: 100 },
                    { field: '@Model.nameof(p => p.Title)', title: '@(ReflectionExtensions.GetPropertyDisplayName<LostReciveItemModel>(m => m.Title))' },
                    { field: '@Model.nameof(p => p.FoundAtAddr)', title: '@(ReflectionExtensions.GetPropertyDisplayName<LostReciveItemModel>(m => m.FoundAtAddr))', width: 95 },
                    { field: '@Model.nameof(p => p.FoundAtTime)', title: '@(ReflectionExtensions.GetPropertyDisplayName<LostReciveItemModel>(m => m.FoundAtTime))', width: 100, templet: function (d) { return util.toDateString(d.FoundAtTime, "yyyy-MM-dd HH:mm:ss"); } },
                    { field: '@Model.nameof(p => p.Status)', title: '@(ReflectionExtensions.GetPropertyDisplayName<LostReciveItemModel>(m => m.Status))', templet: '#statusTemplate', width: 120 },
                    { field: '@Model.nameof(p => p.LosterName)', title: '@(ReflectionExtensions.GetPropertyDisplayName<LostReciveItemModel>(m => m.LosterName))', width: 100 },
                    { field: '@Model.nameof(p => p.LostFoundAddr)', title: '@(ReflectionExtensions.GetPropertyDisplayName<LostReciveItemModel>(m => m.LostFoundAddr))', width: 95 },
                    { field: '@Model.nameof(p => p.LostFoundTime)', title: '@(ReflectionExtensions.GetPropertyDisplayName<LostReciveItemModel>(m => m.LostFoundTime))', width: 100, templet: function (d) { return util.toDateString(d.LostFoundTime, "yyyy-MM-dd HH:mm:ss"); } },
                    { title: '操作', minWidth: 100, templet: '#tableitemBars', fixed: "right", align: "center" }
                ]],
                parseData: function (res) { //res 即为原始返回的数据
                    return {
                        "code": res.state == 200 ? 0 : -1,     //解析接口状态
                        "msg": res.message,     //解析提示文本
                        "count": res.data.RecordsTotal, //解析数据长度
                        "data": res.data.Data,   //解析数据列表
                    };
                },
                page: true,
            };
        });
    </script>
    <script src="~/js/backend/business/lostrecivemanage.min.js" charset="utf-8" asp-append-version="true"></script>
}*@
